﻿using System;
using System.Data;
using System.Collections.Generic;

namespace Demo.Business.EntityServices.Abstract {
	public interface IBaseService<T> where T : class
    {
		/// <summary>
        /// Insert new T
        /// </summary>
        /// <param name="t">T</param>
       	/// <returns>ID of inserted T</returns>
		int Insert(T t);
		
		/// <summary>
        /// Update T
		/// </summary>
        /// <param name="t">T</param>
        /// <returns>Number of items updated</returns>
        int Update(T t);
		
		/// <summary>
        /// Delete T by primary keys
        /// </summary>
        /// <param name="keys">Array of primary keys</param>
        /// <returns>Number of items deleted</returns>
        int Delete(params object[] keys);
		
		/// <summary>
        /// Get list of T
        /// </summary>
        /// <param name="orderBy">Order by string, ex: "PRODUCT_ID ASC"</param>
        /// <param name="page">Index of current page</param>
        /// <param name="pageSize">Number of items  one page</param>
        /// <param name="totalRecords">Total number of items all pages</param>
        /// <returns>List of T</returns>
        List<T> GetList(string orderBy, int page, int pageSize, out int totalRecords);
		
		// <summary>
        /// Get list of T
        /// </summary>
        /// <param name="orderBy">Order by string, ex: "PRODUCT_ID ASC"</param>
        /// <returns>List of T</returns>
		List<T> GetList(string orderBy);
		
		/// <summary>
        /// Get list of T
        /// </summary>
		List<T> GetList();
		
		/// <summary>
        /// Get T by primary keys
        /// </summary>
        /// <param name="keys">Array of primary keys</param>
        /// <returns>T </returns>
       	T Get(params object[] keys);
 		
    }
}